/********************************************************/
/*	Copyright (C) 2016 Gong Li Bin			*/
/*	Project:	GlbCloud			*/
/*	Author:		gong_libin			*/
/*	Date:		2012_02_10			*/
/*	File:		MrPool.h			*/
/********************************************************/

#ifndef _MRPOOL_H
#define	_MRPOOL_H

#include "MrMember.h"


class CMrPool
{
public:
	CMrPool();
	CMrPool(USHORT usTotal);
	virtual ~CMrPool();

	void MrPoolJoin();
	int MrPoolCreate();
	int MrPoolAttrInit();
	void MrPoolDestroy();
	USHORT MrPoolGetTotal();
	void MrPoolDistribute(void* pPara);
	void MrPoolSetTotal(USHORT usTotal);
	void MrPoolSetStartRoutine(void* (*pStartRoutine)(void*));

private:
	USHORT m_usTotal;
	USHORT m_usCursor;
	CMrMember* m_pCMember;
	pthread_attr_t m_stAttr;
	void* (*m_pStartRoutine)(void*);

};

void* MrPoolStartRoutine(void* pSelf);
void MrPoolSetPoolCore(void* (*pPoolCore)(void*));

#endif /* _MRPOOL_H */
